Open
Conversation
dev-tim
reviewed
Aug 28, 2018
chapter1/index.js
Outdated
|
|
||
| console.log(arr[4]) | ||
| Formulas.sinTimesCos = function(a){ | ||
| return Math.sin(a)*Math.cos(a); |
Owner
There was a problem hiding this comment.
Spacing here. Watch out for good programming style.
dev-tim
reviewed
Aug 28, 2018
chapter1/index.js
Outdated
| var i; | ||
| var j; | ||
| var p; | ||
| for(i = 0; i < Object.keys(obj).length; i++){ |
Owner
There was a problem hiding this comment.
you could use let instead of var here. It behaves more like normal variable from Java.
dev-tim
reviewed
Aug 28, 2018
chapter1/index.js
Outdated
| var i; | ||
| var j; | ||
| var p; | ||
| for(i = 0; i < Object.keys(obj).length; i++){ |
Owner
There was a problem hiding this comment.
You could extract Object.keys(obj) to a variable.
dev-tim
reviewed
Aug 28, 2018
| } | ||
|
|
||
| Formulas.parseJSON = function(a){ | ||
| return JSON.parse(a); |
Owner
There was a problem hiding this comment.
Maybe to reason to wrap this stuff in function.
dev-tim
reviewed
Aug 28, 2018
| } | ||
|
|
||
| Formulas.pushToArray = function(a,b){ | ||
| return a.push(b); |
dev-tim
reviewed
Aug 28, 2018
chapter1/index.js
Outdated
| } | ||
| Formulas.squareArrayValues = function(a){ | ||
| var newArr = a; | ||
| for (var i = 0; i < newArr.length; i++){ |
Owner
There was a problem hiding this comment.
- Why not iterate over
a? - Why not giving proper names like
arrayToBeSquared
dev-tim
reviewed
Aug 28, 2018
| } | ||
|
|
||
| Formulas.sortArray = function(a){ | ||
| return a.sort(Formulas.sortNumbers) |
Owner
There was a problem hiding this comment.
Not move one-liners to methods unless there is some specific logic there.
dev-tim
reviewed
Aug 28, 2018
chapter1/index.js
Outdated
| console.log('Get some air in your lungs!'); | ||
| blaFunction(); | ||
| console.log('Now you can rest!') | ||
| Formulas.sortNumbers = function(a,b){ |
Owner
There was a problem hiding this comment.
This is a sortFunction that will be applied to the array.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixed tests by adding function for each tests.
P.S. I plan to revisit the function for searching object value by key.